items1 = document.querySelectorAll(".item1");
items2 = document.querySelectorAll(".item2");
emailInput = document.querySelector(".email-input");
passwordInput = document.querySelector(".password-input");
btn = document.querySelector(".btn");
let i = 0;
let j = 0;
let len1 = items1.length;
let len2 = items2.length;
let flag = true;
let interval;
let interval2;
btn.addEventListener("click", () => {});
emailInput.addEventListener("focus", () => {
  i = 0;
  clearInterval(interval);
  interval = setInterval(() => {
    items1[i].style.marginTop = "-35px";
    i++;
    if (i >= len1) {
      clearInterval(interval);
    }
  }, 40);
});
emailInput.addEventListener("blur", () => {
  i = 0;
  clearInterval(interval);
  if (emailInput.value == "") {
    interval = setInterval(() => {
      items1[i].style.marginTop = "-10px";
      i++;
      if (i >= len1) {
        clearInterval(interval);
      }
    }, 40);
  }
});

passwordInput.addEventListener("focus", () => {
  j = 0;
  clearInterval(interval2);

  interval2 = setInterval(() => {
    items2[j].style.marginTop = "-35px";
    j++;
    if (j >= len2) {
      clearInterval(interval2);
    }
  }, 40);
});
passwordInput.addEventListener("blur", () => {
  j = 0;
  clearInterval(interval2);
  if (passwordInput.value == "") {
    interval2 = setInterval(() => {
      items2[j].style.marginTop = "-10px";
      j++;
      if (j >= len2) {
        clearInterval(interval2);
      }
    }, 40);
  }
});


